Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't modify manifest on failing change #2756

Merged

Conversation

ruben-arts
Copy link
Contributor

Fixes: #2516

We still need to figure out if we could get rid of the intermediary saves but this will help the users with reverting the changes if it fails.

@baszalmstra
Copy link
Contributor

baszalmstra commented Dec 20, 2024 via email

@ruben-arts
Copy link
Contributor Author

@baszalmstra Because we need to update the dependencies directly in file to allow for correct solving of the PyPI environment when it is used as a path = "." dependency. But I have a strong feeling we should find a way we should get rid of this. But the current behavior is really broken, so this is a workaround. If you have better ideas, please share.

@ruben-arts
Copy link
Contributor Author

This also doesn't work with interrupting the add process ...

@Hofer-Julian
Copy link
Contributor

The context is that we need to save the pyproject.toml during upgrading or adding, since changes to project.dependencies need to be available to uv.

If we save, we also need to save in order to revert the change if things go wrong.

@baszalmstra
Copy link
Contributor

Can we only do it for that specific case then?

@nichmor
Copy link
Contributor

nichmor commented Jan 2, 2025

can we pass pyproject.toml from a tmp location to uv? or maybe uv can read it from stdin? this case we don't need to save it back on disk to the original location
cc @tdejager

@tdejager
Copy link
Contributor

tdejager commented Jan 2, 2025

@nichmor that would not work for relative path dependencies?

@nichmor
Copy link
Contributor

nichmor commented Jan 2, 2025

@nichmor that would not work for relative path dependencies?

could we change it to absolute during resolving/building?

@tdejager
Copy link
Contributor

tdejager commented Jan 2, 2025

@nichmor I'm kinda unsure how this solves anyhing, as we are not letting uv read the pyproject.toml in most cases only since we pass in project.dependencies programatically anyways, but I've not dived in to the issue yet :)

@ruben-arts
Copy link
Contributor Author

I changed the logic so that we only intermediary save when the manifest is a pyproject.toml. And then always revert the manifest on a dry-run.

Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this in :)

@ruben-arts ruben-arts enabled auto-merge (squash) January 2, 2025 16:14
@ruben-arts ruben-arts merged commit 1f9daf5 into prefix-dev:main Jan 2, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding a package adds it to pixi.toml even if it failed
5 participants